

import { InjectionToken, singleton } from "tsyringe";
import { IListener } from "../../core/listener";
import { ISender } from "../../core/sender";
import { STOP_SCRIPT } from "../../tokens/args";
import { ScriptManager } from "../scriptManager";
import { tryGet } from "../../utils";

export class StopScriptListener implements IListener {
    type: InjectionToken<any> = STOP_SCRIPT;
    constructor() { }
    on = (payload: string, manager: ISender): void => {
        const scriptManager = tryGet(ScriptManager)
        scriptManager.stop(payload)
    }
}